home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / misc / dspice0s / intgr8.c < prev    next >
C/C++ Source or Header  |  1992-11-21  |  7KB  |  186 lines

  1. /* intgr8.f -- translated by f2c (version of 3 February 1990  3:36:42).
  2.    You must link the resulting object file with the libraries:
  3.     -lF77 -lI77 -lm -lc   (in that order)
  4. */
  5.  
  6. #include "f2c.h"
  7.  
  8. /* Common Block Declarations */
  9.  
  10. struct {
  11.     integer ielmnt, isbckt, nsbckt, iunsat, nunsat, itemps, numtem, isens, 
  12.         nsens, ifour, nfour, ifield, icode, idelim, icolum, insize, 
  13.         junode, lsbkpt, numbkp, iorder, jmnode, iur, iuc, ilc, ilr, 
  14.         numoff, isr, nmoffc, iseq, iseq1, neqn, nodevs, ndiag, iswap, 
  15.         iequa, macins, lvnim1, lx0, lvn, lynl, lyu, lyl, lx1, lx2, lx3, 
  16.         lx4, lx5, lx6, lx7, ld0, ld1, ltd, imynl, imvn, lcvn, nsnod, 
  17.         nsmat, nsval, icnod, icmat, icval, loutpt, lpol, lzer, irswpf, 
  18.         irswpr, icswpf, icswpr, irpt, jcpt, irowno, jcolno, nttbr, nttar, 
  19.         lvntmp;
  20. } tabinf_;
  21.  
  22. #define tabinf_1 tabinf_
  23.  
  24. struct {
  25.     doublereal omega, time, delta, delold[7], ag[7], vt, xni, egfet, xmu, 
  26.         sfactr;
  27.     integer mode, modedc, icalc, initf, method, iord, maxord, noncon, iterno, 
  28.         itemno, nosolv, modac, ipiv, ivmflg, ipostp, iscrch, iofile;
  29. } status_;
  30.  
  31. #define status_1 status_
  32.  
  33. struct {
  34.     doublereal value[200000];
  35. } blank_;
  36.  
  37. #define blank_1 blank_
  38.  
  39. /*<       subroutine intgr8(geq,ceq,capval,loct) >*/
  40. /* Subroutine */ int intgr8_(geq, ceq, capval, loct)
  41. doublereal *geq, *ceq, *capval;
  42. integer *loct;
  43. {
  44.     /* Local variables */
  45. #define ccap ((doublereal *)&blank_1 + 1)
  46. #define qcap ((doublereal *)&blank_1)
  47. #define nodplc ((integer *)&blank_1)
  48. #define cvalue ((complex *)&blank_1)
  49.  
  50. /*<       implicit double precision (a-h,o-z) >*/
  51.  
  52. /*     this routine performs the actual numerical integration for each */
  53. /* circuit element. */
  54.  
  55. /* spice version 2g.6  sccsid=tabinf 3/15/83 */
  56. /*<       common /tabinf/ ielmnt,isbckt,nsbckt,iunsat,nunsat,itemps,numtem, >*/
  57. /*<      1   isens,nsens,ifour,nfour,ifield,icode,idelim,icolum,insize, >*/
  58. /*<      2   junode,lsbkpt,numbkp,iorder,jmnode,iur,iuc,ilc,ilr,numoff,isr, >*/
  59. /*<      3   nmoffc,iseq,iseq1,neqn,nodevs,ndiag,iswap,iequa,macins,lvnim1, >*/
  60. /*<      4   lx0,lvn,lynl,lyu,lyl,lx1,lx2,lx3,lx4,lx5,lx6,lx7,ld0,ld1,ltd, >*/
  61. /*<      5   imynl,imvn,lcvn,nsnod,nsmat,nsval,icnod,icmat,icval, >*/
  62. /*<      6   loutpt,lpol,lzer,irswpf,irswpr,icswpf,icswpr,irpt,jcpt, >*/
  63. /*<      7   irowno,jcolno,nttbr,nttar,lvntmp >*/
  64. /* spice version 2g.6  sccsid=status 3/15/83 */
  65. /*<       common /status/ omega,time,delta,delold(7),ag(7),vt,xni,egfet, >*/
  66. /*<      1   xmu,sfactr,mode,modedc,icalc,initf,method,iord,maxord,noncon, >*/
  67. /*<      2   iterno,itemno,nosolv,modac,ipiv,ivmflg,ipostp,iscrch,iofile >*/
  68. /* spice version 2g.6  sccsid=blank 3/15/83 */
  69. /*<       common /blank/ value(200000) >*/
  70. /*<       integer nodplc(64) >*/
  71. /*<       complex cvalue(32) >*/
  72. /*<       equivalence (value(1),nodplc(1),cvalue(1)) >*/
  73.  
  74.  
  75. /*<       dimension qcap(1),ccap(1) >*/
  76. /*<       equivalence (qcap(1),value(1)),(ccap(1),value(2)) >*/
  77.  
  78.  
  79. /*<       if (method.eq.2) go to 100 >*/
  80.     if (status_1.method == 2) {
  81.     goto L100;
  82.     }
  83.  
  84. /*  trapezoidal algorithm */
  85.  
  86. /*<       if (iord.eq.1) go to 100 >*/
  87.     if (status_1.iord == 1) {
  88.     goto L100;
  89.     }
  90. /*<       ccap(lx0+loct)=-ccap(lx1+loct)*ag(2) >*/
  91. /*<      1   +ag(1)*(qcap(lx0+loct)-qcap(lx1+loct)) >*/
  92.     ccap[tabinf_1.lx0 + *loct - 1] = -ccap[tabinf_1.lx1 + *loct - 1] * 
  93.         status_1.ag[1] + status_1.ag[0] * (qcap[tabinf_1.lx0 + *loct - 1] 
  94.         - qcap[tabinf_1.lx1 + *loct - 1]);
  95. /*<       go to 190 >*/
  96.     goto L190;
  97.  
  98. /*  gears algorithm */
  99.  
  100. /*<   100 go to (110,120,130,140,150,160), iord >*/
  101. L100:
  102.     switch (status_1.iord) {
  103.     case 1:  goto L110;
  104.     case 2:  goto L120;
  105.     case 3:  goto L130;
  106.     case 4:  goto L140;
  107.     case 5:  goto L150;
  108.     case 6:  goto L160;
  109.     }
  110. /*<   110 ccap(lx0+loct)=ag(1)*qcap(lx0+loct)+ag(2)*qcap(lx1+loct) >*/
  111. L110:
  112.     ccap[tabinf_1.lx0 + *loct - 1] = status_1.ag[0] * qcap[tabinf_1.lx0 + *
  113.         loct - 1] + status_1.ag[1] * qcap[tabinf_1.lx1 + *loct - 1];
  114. /*<       go to 190 >*/
  115.     goto L190;
  116. /*<   120 ccap(lx0+loct)=ag(1)*qcap(lx0+loct)+ag(2)*qcap(lx1+loct) >*/
  117. /*<      1              +ag(3)*qcap(lx2+loct) >*/
  118. L120:
  119.     ccap[tabinf_1.lx0 + *loct - 1] = status_1.ag[0] * qcap[tabinf_1.lx0 + *
  120.         loct - 1] + status_1.ag[1] * qcap[tabinf_1.lx1 + *loct - 1] + 
  121.         status_1.ag[2] * qcap[tabinf_1.lx2 + *loct - 1];
  122. /*<       go to 190 >*/
  123.     goto L190;
  124. /*<   130 ccap(lx0+loct)=ag(1)*qcap(lx0+loct)+ag(2)*qcap(lx1+loct) >*/
  125. /*<      1              +ag(3)*qcap(lx2+loct)+ag(4)*qcap(lx3+loct) >*/
  126. L130:
  127.     ccap[tabinf_1.lx0 + *loct - 1] = status_1.ag[0] * qcap[tabinf_1.lx0 + *
  128.         loct - 1] + status_1.ag[1] * qcap[tabinf_1.lx1 + *loct - 1] + 
  129.         status_1.ag[2] * qcap[tabinf_1.lx2 + *loct - 1] + status_1.ag[3] *
  130.          qcap[tabinf_1.lx3 + *loct - 1];
  131. /*<       go to 190 >*/
  132.     goto L190;
  133. /*<   140 ccap(lx0+loct)=ag(1)*qcap(lx0+loct)+ag(2)*qcap(lx1+loct) >*/
  134. /*<      1              +ag(3)*qcap(lx2+loct)+ag(4)*qcap(lx3+loct) >*/
  135. /*<      2              +ag(5)*qcap(lx4+loct) >*/
  136. L140:
  137.     ccap[tabinf_1.lx0 + *loct - 1] = status_1.ag[0] * qcap[tabinf_1.lx0 + *
  138.         loct - 1] + status_1.ag[1] * qcap[tabinf_1.lx1 + *loct - 1] + 
  139.         status_1.ag[2] * qcap[tabinf_1.lx2 + *loct - 1] + status_1.ag[3] *
  140.          qcap[tabinf_1.lx3 + *loct - 1] + status_1.ag[4] * qcap[
  141.         tabinf_1.lx4 + *loct - 1];
  142. /*<       go to 190 >*/
  143.     goto L190;
  144. /*<   150 ccap(lx0+loct)=ag(1)*qcap(lx0+loct)+ag(2)*qcap(lx1+loct) >*/
  145. /*<      1              +ag(3)*qcap(lx2+loct)+ag(4)*qcap(lx3+loct) >*/
  146. /*<      2              +ag(5)*qcap(lx4+loct)+ag(6)*qcap(lx5+loct) >*/
  147. L150:
  148.     ccap[tabinf_1.lx0 + *loct - 1] = status_1.ag[0] * qcap[tabinf_1.lx0 + *
  149.         loct - 1] + status_1.ag[1] * qcap[tabinf_1.lx1 + *loct - 1] + 
  150.         status_1.ag[2] * qcap[tabinf_1.lx2 + *loct - 1] + status_1.ag[3] *
  151.          qcap[tabinf_1.lx3 + *loct - 1] + status_1.ag[4] * qcap[
  152.         tabinf_1.lx4 + *loct - 1] + status_1.ag[5] * qcap[tabinf_1.lx5 + *
  153.         loct - 1];
  154. /*<       go to 190 >*/
  155.     goto L190;
  156. /*<   160 ccap(lx0+loct)=ag(1)*qcap(lx0+loct)+ag(2)*qcap(lx1+loct) >*/
  157. /*<      1              +ag(3)*qcap(lx2+loct)+ag(4)*qcap(lx3+loct) >*/
  158. /*<      2              +ag(5)*qcap(lx4+loct)+ag(6)*qcap(lx5+loct) >*/
  159. /*<      3              +ag(7)*qcap(lx6+loct) >*/
  160. L160:
  161.     ccap[tabinf_1.lx0 + *loct - 1] = status_1.ag[0] * qcap[tabinf_1.lx0 + *
  162.         loct - 1] + status_1.ag[1] * qcap[tabinf_1.lx1 + *loct - 1] + 
  163.         status_1.ag[2] * qcap[tabinf_1.lx2 + *loct - 1] + status_1.ag[3] *
  164.          qcap[tabinf_1.lx3 + *loct - 1] + status_1.ag[4] * qcap[
  165.         tabinf_1.lx4 + *loct - 1] + status_1.ag[5] * qcap[tabinf_1.lx5 + *
  166.         loct - 1] + status_1.ag[6] * qcap[tabinf_1.lx6 + *loct - 1];
  167. /* ... ceq is the equivalent current applicable to linear capacitance */
  168. /*    (inductance) only, i.e. q=c*v */
  169. /*<   190 ceq=ccap(lx0+loct)-ag(1)*qcap(lx0+loct) >*/
  170. L190:
  171.     *ceq = ccap[tabinf_1.lx0 + *loct - 1] - status_1.ag[0] * qcap[
  172.         tabinf_1.lx0 + *loct - 1];
  173. /*<       geq=ag(1)*capval >*/
  174.     *geq = status_1.ag[0] * *capval;
  175. /*<       return >*/
  176.     return 0;
  177. /*<       end >*/
  178. } /* intgr8_ */
  179.  
  180. #undef cvalue
  181. #undef nodplc
  182. #undef qcap
  183. #undef ccap
  184.  
  185.  
  186.